package com.wnhz.work.jy.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import com.wnhz.work.jy.R;

/**
 * Created by Administrator on 2016/10/20 0020.
 */
public class PayPassAdapter extends BaseAdapter {
    private Context context;
    private String[] nums;

    public PayPassAdapter(Context context, String[] nums) {
        this.context = context;
        this.nums = nums;
    }

    @Override
    public int getCount() {
        return nums.length;
    }

    @Override
    public Object getItem(int position) {
        return null;
    }

    @Override
    public long getItemId(int position) {
        return 0;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        PayPassViewHolder viewHolder = new PayPassViewHolder();
        if (convertView == null) {
            convertView = LayoutInflater.from(context).inflate(R.layout.pay_pass_item, null);
            viewHolder.tv_number_pay = (TextView) convertView.findViewById(R.id.tv_number_pay);
            viewHolder.iv_pic = (ImageView) convertView.findViewById(R.id.iv_pic);

            convertView.setTag(viewHolder);
        } else {
            viewHolder = (PayPassViewHolder) convertView.getTag();
        }

        viewHolder.tv_number_pay.setText(nums[position]);
        if (position == 11) {
            viewHolder.iv_pic.setVisibility(View.VISIBLE);
            viewHolder.iv_pic.setImageResource(R.mipmap.ic_guanbi);
        }
        return convertView;
    }

    class PayPassViewHolder {
        TextView tv_number_pay;
        ImageView iv_pic;
    }
}
